<template>
  <a-row :gutter="5">
    <a-col :span="4">
      <deptTree v-model="superParam.deptId"/>
    </a-col>
    <a-col :span="20">
      <a-card>
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          @change="handleTableChange">
        <span slot="actionName">
          <a-button size="small" @click="handleAdd('方案-新增')" type="primary" icon="plus">新增</a-button>
        </span>
          <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'方案-编辑')">编辑</a>
           <a-divider type="vertical"/>
          <a @click="handleEditTree(record,'方案树-编辑')">方案树编辑</a>
           <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
        </a-table>
      </a-card>
      <!-- table区域-end -->
      <CheckAndEditModel ref="modalForm" @ok="modalFormOk" :deptId="superParam.deptId"></CheckAndEditModel>
      <faTree ref="faTree" :deptId="superParam.deptId"></faTree>
    </a-col>
  </a-row>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import faTree from './faTree'
  import columns from './indexColumns'
  import deptTree from './deptTree'

  export default {
    name: 'sjrygl',
    mixins: [JeecgListMixin],
    components: {
      CheckAndEditModel,
      faTree,
      deptTree
    },
    data() {
      return {
        queryParam: {},
        superParam: {},
        disableMixinCreated: true,
        // 表头
        columns: columns(this),
        url: {
          list: '/sjxmzygl/sjWorkProjectTempDept/queryTemplateByDeptId',
          delete: '/sjxmzygl/sjWorkProjectTempDept/delete'
        },
      }
    },
    watch: {
      'superParam.deptId': function () {
        this.loadData()
      }
    },
    computed: {},
    created() {
    },
    methods: {
      handleEditTree(record, name) {
        this.$refs.faTree.edit(record);
        this.$refs.faTree.title = name;
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'

</style>

<style lang="less" scoped>
  .ant-row {
    height: 100%;

    .ant-col {
      height: 100%;

      .ant-card {
        height: 100%;

        /deep/ .ant-card-body {
          padding: 15px;
        }
      }
    }

  }
</style>